import { BUNDLE_TYPE_ENUM } from "../base/EnumIndex";
import { ResManager } from "../manager/ResManager";
import { ICollectConfig } from "./GlobalData";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ItemCollect extends cc.Component {

    @property({ type: cc.Sprite, tooltip: "图" })
    private icon: cc.Sprite = null;

    @property({ type: cc.Label, tooltip: "名字" })
    private labName: cc.Label = null;

    private _config: ICollectConfig = null;
    public get config() {
        return this._config;
    }

    public async setData(config: ICollectConfig) {
        this._config = config;

        // const url = `texture/screw/${carComp.carData.color + '0'}`;
        // this.icon.spriteFrame = await ResManager.ins.loadRes(url, cc.SpriteFrame, BUNDLE_TYPE_ENUM.GAME_PLAY);
        this.labName.string = `${config.name}`;
    }
}